package hc.j2me;

import hc.core.UDPReceiveServer;

import java.io.IOException;

import javax.microedition.io.Datagram;
import javax.microedition.io.UDPDatagramConnection;

public class J2MEUDPReceiveServer extends UDPReceiveServer {
	
	public void receiveUDP(Object dp) throws IOException{
        ((UDPDatagramConnection)socket).receive((Datagram)dp);  
	}
	
	public void shutDown() {
    	isShutdown = true;
    	try {
    		((UDPDatagramConnection)socket).close();
		} catch (Exception e) {
		}
//    	thread.stop();
	}

	public void closeOldSocket() {
		if(socket != null){
			try {
	    		((UDPDatagramConnection)socket).close();
			} catch (Exception e) {
			}
		}
		socket = null;
	}

}
